<template>
  <div>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <div class="page">
      <div class="page-top">
        <div class="title">影片库管理系统</div>
        <div class="user right">当前登录：{{ usertoken }}</div>
      </div>
      <div class="nav-cover"></div>
      <div class="page-nav">
        <div class="logo">Mtime</div>
        <div
          class="nav-group"
          v-for="menuitem in menusItem"
          :key="menuitem.groupName"
        >
          <div class="label">{{ menuitem.groupName }}</div>
          <ul class="menu" v-for="item in menuitem.items" :key="item.menuName">
            <li class="item">{{ item.menuName }}</li>
          </ul>
        </div>
      </div>
      <div class="page-body"></div>
      <div class="page-bottom">
        <div class="text">
          企业级开发技术-WEB客户端开发技术课程案例-实验15 ©NIIT-SCS
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      menusItem: "",
      usertoken: "",
    };
  },
  mounted() {
    let params = this.$route.query;
    this.usertoken = params.usertoken;
    this.$http
      .request({
        url: "/api/admin/menus",
        method: "get",
        headers: {
          Authorization: this.usertoken,
        },
      })
      .then((response) => {
        if (response.status == 200) {
          this.menusItem = response.data;
        }
      })
      .catch((err) => {
        if (err.response.status == 403) {
          console.log("获取菜单失败--权限错误!");
        } else {
          console.log("获取菜单失败--其他错误!");
        }
      });
  },
};
</script>
<style>
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  padding: 0;
  margin: 0;
}
.page {
  width: 100%;
  height: 100%;
  background-color: #eee;
  display: flex;
  flex-direction: column;
}
.page-top {
  width: calc(100% - 260px);
  height: 60px;
  background-color: #fff;
  position: fixed;
  top: 0;
  left: 260px;
  display: flex;
  align-items: center;
  color: #777;
  border-bottom: 0.6px solid rgba(99, 99, 99, 0.5);
}
.page-bottom {
  width: calc(100% - 260px);
  height: 60px;
  background-color: #eee;
  position: fixed;
  bottom: 0;
  left: 260px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #999999;
}
.page-nav {
  width: 260px;
  height: 100%;
  background: linear-gradient(to bottom, #fb404b 0, rgba(187, 5, 2, 0.6) 100%);
  position: fixed;
  left: 0;
  top: 0;
  color: #fff;
  z-index: 2;
}
.page-body {
  padding-left: 260px;
  padding-top: 60px;
  padding-bottom: 60px;
  overflow: auto;
  min-width: calc(100% - 260px);
  min-height: calc(100% - 120px);
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}

.logo {
  font-size: 230%;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 60px;
  width: 96%;
  border-bottom: 0.5px solid rgba(200, 200, 200, 0.7);
}
.title {
  font-size: 110%;
  margin-left: 30px;
}

.right {
  flex: 1;
  text-align: right;
  padding-right: 20px;
}
.nav-group {
  font-size: 100%;
  width: 100%;
  margin-top: 20px;
}
.nav-group .label {
  line-height: 40px;
  width: 96%;
  margin: 0 auto;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  /* border-bottom:0.5px solid rgba(200,200,200,0.7); */
}
.nav-group .menu {
  margin: 0 auto;
  padding: 5px 0;
  width: 100%;
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.nav-group .menu .item {
  line-height: 40px;
  cursor: pointer;
}
.nav-cover {
  position: fixed;
  left: 0;
  top: 0;
  width: 260px;
  height: 100%;
  background-image: url("https://demos.creative-tim.com/light-bootstrap-dashboard-pro-angular2/assets/img/full-screen-image-3.jpg");
  background-repeat: no-repeat;
  background-size: cover;
  z-index: 1;
}
.box {
  width: 400px;
  height: 400px;
  background-color: #fff;
  margin-bottom: 20px;
}
</style>